package es.ats.codington.festival.utils;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * This source code tries to establish a connection to a MySQL server
 * and displays a message concerning the error if connection fails
 *  
 * @author equipo Transit
 *
 */
public class FERSDataConnection {

	static Connection con ;
	
	/**
	 * This source code tries to establish a connection to a MySQL server
	 * and displays a message concerning the error if connection fails
	 * Following method creates a connection and returns it
	 * @return
	 */
	public static Connection getConnection() {


			 try {
			//	 JSonAccess json = new JSonAccess();
			  
			//Class.forName(json.getBDDriver());
			
		    Class.forName("com.mysql.jdbc.Driver");	 
				 
			//Obtaining a connection using DriverManager class
			
		   // con = DriverManager.getConnection(json.getBDUrl(), json.getBDUser(), json.getBDPass());
				 
		    con = DriverManager.getConnection("jdbc:mysql://localhost/codingtontransit", "root", "abcd1234");	 
		 
				
			} catch (ClassNotFoundException e) {
				
				e.printStackTrace();
			} catch (SQLException e) {
				
				e.printStackTrace();
			}
				
		
		return con;
	}
	
	
	
	
	
	
}
